

#include <iostream>
#include <unordered_map>
#include <map>
#include <vector>

class TestA {

    public:

        TestA() { std::cout << "TestA constructor " << std::endl;}
        ~TestA() { std::cout << "TestA ~destructor " << std::endl;}
};

void test_case1() {

    std::unordered_map<int, TestA> m;
    m.insert( {1, std::move(TestA())});
    m.clear();
}

void test_case2() {

    std::unordered_map<int, int> m;
    m.insert({2, 22});
    auto i = m.find(2);
    std::cout << i->first << " " << i->second << std::endl;
}

void test_case3() {

    // initialize container 
    std::multimap<int, int> mp; 
    // insert elements in random order 
    mp.insert({ 2, 30 }); 
    mp.insert({ 1, 40 }); 
    mp.insert({ 3, 60 }); 
    mp.insert({ 1, 20 }); 
    mp.insert({ 5, 50 }); 
  
    // Stores the range of key 1 
    auto it = mp.equal_range(1); 
  
    std::cout << "The multimap elements of key 1 is : \n"; 
    std::cout << "KEY\tELEMENT\n"; 
  
    // Prints all the elements of key 1 
    for (auto itr = it.first; itr != it.second; ++itr) { 
        std::cout << itr->first 
             << '\t' << itr->second << '\n'; 
    } 
}


int main() {

    //test_case1();
    //test_case2();
    test_case3();
    return 0;
}